import   DesignView from '@/editor/js/design-view/design-view'
export default class ServicePreview {
  constructor(){
    var designView = new DesignView(self.options, application, this.jsPlumbInstance);
    this._designView = designView;
  }
  getDesign(){
    var self=this;
    var response = self._designView.getDesign(self.getContent());
    if (response.status === "success") {
      self.JSONObject = JSON.parse(response.responseString);

      if (!self.canTranslateToWizard(self.JSONObject)) {
        DesignViewUtils.prototype.errorAlert('This Siddhi app cannot be opened in ETL Wizard mode');
        return;
      }

      sourceContainer.hide();
      etlWizardContainer.show();
      var etlOptions = _.cloneDeep(self.options);
      etlOptions.dataModel = self.JSONObject;

      new ETLWizard(etlOptions);
    } else if (response.status === "fail") {
      loadingScreen.hide();
      DesignViewUtils.prototype.errorAlert(response.errorMessage);
    }
  }
}
